import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/27 8:10
 * @description:
 */
public class task11 {

  public static void main(String[] args) {
    HashMap<Integer,String> stringHashMap=new HashMap<Integer,String>();
    stringHashMap.put(1,"张三");
    stringHashMap.put(1,"里斯");
    stringHashMap.put(2,"王五");
    stringHashMap.put(3,"王五");



    Iterator iterator=stringHashMap.keySet().iterator();
    while (iterator.hasNext()){
      Integer key=(Integer) iterator.next();
      String value=stringHashMap.get(key);
      System.out.println(key+"："+value);
    }
    System.out.println();


    Iterator entryIterator= stringHashMap.entrySet().iterator();
    while (entryIterator.hasNext()){
      Map.Entry<Integer,String>entry= (Entry<Integer, String>) entryIterator.next();
    Integer key=entry.getKey();
    String value =entry.getValue();
      System.out.println(key+"--"+value);
    }
  }

}
